package com.pro.api;

import com.pro.dto.Dto;
import com.pro.service.MinioTestService;
import com.pro.util.dtoUtil.DtoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("upload")
public class UploadController {
    @Autowired
    private MinioTestService minioTestService;

    /**
     * 上传图片
     * */
    @PostMapping("uploadBrowser")
    public Dto uploadBrower(@RequestParam(value = "folder")String folder , @RequestParam(value = "file") MultipartFile file){
        return DtoUtil.returnSuccess(minioTestService.uploadImage(folder, file));
    }
}
